\(\int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx\) [412]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 24 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b \text {arctanh}(\sin (c+d x))}{d}+\frac {a \tan (c+d x)}{d} \]

[Out]

b*arctanh(sin(d*x+c))/d+a*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.211, Rules used = {2827, 3852, 8, 3855} \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {a \tan (c+d x)}{d}+\frac {b \text {arctanh}(\sin (c+d x))}{d} \]

[In]

Int[(a + b*Cos[c + d*x])*Sec[c + d*x]^2,x]

[Out]

(b*ArcTanh[Sin[c + d*x]])/d + (a*Tan[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2827

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[c, Int[(b*S
in[e + f*x])^m, x], x] + Dist[d/b, Int[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = a \int \sec ^2(c+d x) \, dx+b \int \sec (c+d x) \, dx \\ & = \frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {a \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d} \\ & = \frac {b \text {arctanh}(\sin (c+d x))}{d}+\frac {a \tan (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b \text {arctanh}(\sin (c+d x))}{d}+\frac {a \tan (c+d x)}{d} \]

[In]

Integrate[(a + b*Cos[c + d*x])*Sec[c + d*x]^2,x]

[Out]

(b*ArcTanh[Sin[c + d*x]])/d + (a*Tan[c + d*x])/d

Maple [A] (verified)

Time = 2.21 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.25

method result size
derivativedivides \(\frac {\tan \left (d x +c \right ) a +b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(30\)
default \(\frac {\tan \left (d x +c \right ) a +b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(30\)
parts \(\frac {a \tan \left (d x +c \right )}{d}+\frac {b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(32\)
risch \(\frac {2 i a}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b}{d}\) \(59\)
parallelrisch \(\frac {-b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \cos \left (d x +c \right )+b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \cos \left (d x +c \right )+a \sin \left (d x +c \right )}{d \cos \left (d x +c \right )}\) \(63\)
norman \(\frac {-\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 a \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(101\)

[In]

int((a+cos(d*x+c)*b)*sec(d*x+c)^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(tan(d*x+c)*a+b*ln(sec(d*x+c)+tan(d*x+c)))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 60 vs. \(2 (24) = 48\).

Time = 0.28 (sec) , antiderivative size = 60, normalized size of antiderivative = 2.50 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - b \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, a \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]

[In]

integrate((a+b*cos(d*x+c))*sec(d*x+c)^2,x, algorithm="fricas")

[Out]

1/2*(b*cos(d*x + c)*log(sin(d*x + c) + 1) - b*cos(d*x + c)*log(-sin(d*x + c) + 1) + 2*a*sin(d*x + c))/(d*cos(d
*x + c))

Sympy [F]

\[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\int \left (a + b \cos {\left (c + d x \right )}\right ) \sec ^{2}{\left (c + d x \right )}\, dx \]

[In]

integrate((a+b*cos(d*x+c))*sec(d*x+c)**2,x)

[Out]

Integral((a + b*cos(c + d*x))*sec(c + d*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.58 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, a \tan \left (d x + c\right )}{2 \, d} \]

[In]

integrate((a+b*cos(d*x+c))*sec(d*x+c)^2,x, algorithm="maxima")

[Out]

1/2*(b*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 2*a*tan(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 63 vs. \(2 (24) = 48\).

Time = 0.30 (sec) , antiderivative size = 63, normalized size of antiderivative = 2.62 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1}}{d} \]

[In]

integrate((a+b*cos(d*x+c))*sec(d*x+c)^2,x, algorithm="giac")

[Out]

(b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - b*log(abs(tan(1/2*d*x + 1/2*c) - 1)) - 2*a*tan(1/2*d*x + 1/2*c)/(tan(1
/2*d*x + 1/2*c)^2 - 1))/d

Mupad [B] (verification not implemented)

Time = 13.81 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.96 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {2\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {2\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \]

[In]

int((a + b*cos(c + d*x))/cos(c + d*x)^2,x)

[Out]

(2*b*atanh(tan(c/2 + (d*x)/2)))/d - (2*a*tan(c/2 + (d*x)/2))/(d*(tan(c/2 + (d*x)/2)^2 - 1))